package com.titanrise.crm.controller;

import com.titanrise.crm.environment.annotation.Autowired;
import com.titanrise.crm.environment.annotation.Controller;
import com.titanrise.crm.environment.annotation.FunctionConfig;
import com.titanrise.crm.environment.annotation.MenuConfig;
import com.titanrise.crm.environment.menu.MenuContext;
import com.titanrise.crm.environment.menu.action.Action;
import com.titanrise.crm.service.IndexService;

@Controller(basePath = "/")
public class IndexController {
    @Autowired
    private IndexService indexService;

    @MenuConfig(path = "/", divider = "=====客户关系管理系统=====")
    @FunctionConfig(path = "/", key = 1, description = "登录")
    public Action index1(MenuContext context) {
        return indexService.login(context);
    }

    @FunctionConfig(path = "/", key = 2, description = "注册")
    public Action index2(MenuContext context) {
        return indexService.register(context);
    }

    @FunctionConfig(path = "/", key = 3, description = "退出", divider = "")
    public Action index3() {
        System.out.println("感谢使用！再见……");
        return Action.EXIT();
    }
}
